package com.yqg.protection.netty.encode.factory;

import com.yqg.protection.netty.encode.ProtocolDiscriminator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class ProtocolDiscriminatorFactory {

    private static final Logger log = LoggerFactory.getLogger(ProtocolDiscriminatorFactory.class);

    private final ApplicationContext applicationContext;

    @Autowired
    public ProtocolDiscriminatorFactory(ApplicationContext applicationContext) {
        this.applicationContext = applicationContext;
        log.info("协议识别器工厂已创建");
    }

    public ProtocolDiscriminator create() {
        log.info("创建新的协议识别器实例");
        return new ProtocolDiscriminator(applicationContext);
    }
}
